Keyword Reference

#include-once

Specifies that the current file may only be included once.

#include-once

 

Parameters

None.

 

Remarks

If you include the same file containing a user-function more than once, you will get a "Duplicate function" error. When writing an include file that may be used in this way, make sure that the top line contains #include-once to prevent that file from being included more than once.

 

Related

#include, FileInstall

 

Example


;;; LIBRARY.AU3 ;;;
#include-once

Func myFunc()
    MsgBox(0,"", "Hello from library.au3")
EndFunc


;;; SCRIPT.AU3 ;;;
#include "Library.au3"
#include "Library.au3"  ;throws an error if #include-once was not used

MsgBox(0, "Example", "This is from 'script.au3' file")
myFunc()
Exit

; Running script.au3 will output the two message boxes:
; one saying "This is from 'script.au3' file"
; and another saying "Hello from library.au3"